package com.huika.dealontop.control.pay.utils;

import android.app.Activity;
import android.content.Intent;

import com.huika.dealontop.config.UrlConstants;
import com.huika.dealontop.control.base.BaseAct;
import com.huika.dealontop.control.pay.activity.OmisePayActivity;

/**
 * Description:Omise支付帮助类
 * Created by zhouweiyong on 2015/11/20.
 */
public class OmisePay extends BasePay {
    private Activity act;
    public static String publicKey = "pkey_test_50xql6uiumu2igwvqpb";
    private boolean needCloseCurrentPage;



    public OmisePay(Activity act, boolean needCloseCurrentPage) {
        this.act = act;
        this.needCloseCurrentPage = needCloseCurrentPage;
        if(UrlConstants.isReleaseEnvironment()) {
            publicKey = "pkey_517ha6c01hziobxamro";
        } else {
            //publicKey = "pkey_test_50xql6uiumu2igwvqpb";
            publicKey = "pkey_test_5169dloysa3ppnkq1vw";
        }
    }

    @Override
    public void pay() {
        //进入支付页面
        Intent intent = new Intent(act, OmisePayActivity.class);
        intent.putExtra(PAYORDERNO, getPayOrderNo());
        intent.putExtra(TOTALMONEY, getTotalMoney());
        intent.putExtra(ORDERNO,getOrderNo());
        intent.putExtra(PHONE,getPhone());
        intent.putExtra(USERID,getUserId());
        intent.putExtra(NEEDCLOSECURRENTPAGE, needCloseCurrentPage);
        ((BaseAct)act).showActivity(act, intent);
    }
}
